import { useEffect, useState } from 'react'
import { Carousel } from 'antd';
import style from './style.module.less'
import cls from 'classnames'
import { articleList } from '@/api/article';
function BaseCarousel() {
    const [countList, setcountList] = useState([]);
    useEffect(() => {
        articleList().then((res) => {
            setcountList(res.data.data[0])
        })
    }, [])

    return (
        <Carousel className={cls('BaseCarousel', style.BaseCarousel)} autoplay={true}>
            {
                countList.length ? countList.map((item) => {
                    return <div style={cls('Carousel', style.Carousel)} key={item.id}>
                        <img src={item.cover} alt="" style={{ width: "100%", height: "100%" }} />
                    </div>
                }) : (<div>暂无数据</div>)
            }
        </Carousel>
    )
}

export default BaseCarousel 